package VolumePartition;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class partition extends Partitioner<Text, VolumePartitionFlowBean>  {
    @Override
    public int getPartition(Text text, VolumePartitionFlowBean flowBean, int i) {
        double volume = flowBean.getVolume();
        i =(int) volume / 100000 + 1;

        int partition = 6;

        if(i>120)
            partition = 0;
        else if (i>100)
            partition = 1;
        else if (i>80)
            partition = 2;
        else if (i>60)
            partition = 3;
        else if (i>40)
            partition = 4;
        else
            partition = 5;

        return partition;
    }

}
